﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.SimpleFlow
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.SimpleFlow;

    public class map_ApprovalRecordType : EntityMapping<ApprovalRecordType>
    {
        public map_ApprovalRecordType()
        {
            Property(x => x.TypeName, map =>
            {
                map.Length(20);
            });

            Property(x => x.TypeCode, map =>
            {
                map.Length(20);
            });

            Property(x => x.TypeDiscribe, map =>
            {
                map.Length(500);
            });

            Property(x => x.UrlForApprove, map =>
            {
                map.Length(500);
            });

            Property(x => x.UrlForHold, map =>
            {
                map.Length(500);
            });

            Property(x => x.UrlForReject, map =>
            {
                map.Length(500);
            });

            Property(x => x.UrlForSP, map =>
            {
                map.Length(500);
            });

            Property(x => x.CanApprovalRoleCodes, map =>
            {
                map.Length(800000);
            });

            Property(x => x.BusinessSystemCallInterfaceIP1, map =>
            {
                map.Length(20);
            });

            Property(x => x.BusinessSystemCallInterfaceIP2, map =>
            {
                map.Length(20);
            });

            Property(x => x.SimpleFlowCallInterfaceIP1, map =>
            {
                map.Length(20);
            });

            Property(x => x.SimpleFlowCallInterfaceIP2, map =>
            {
                map.Length(20);
            });

            //类型所包含的流程记录列表
            Bag(x => x.Records, map =>
            {
                map.Key(keyMapper => keyMapper.Column("TypeID"));
            }, rel => rel.OneToMany());

        }
    }
}
